/**
 * Created by cells on 2015/12/21.
 */
function btnClick(){
    var businessHeight = $("#business").offset().top - 160;
    var caseHeight = $("#productUrl").offset().top - 160;
    var customerHeight = $("#customer").offset().top - 160;
    var aboutHeight = $("#foot").offset().top - 160;
    $(".homeUrl").click(function(){
        $(".nav_title .homeUrl").addClass("active").siblings().removeClass('active');
        $(window).scrollTop(0);
    });
    $(".businessUrl").click(function(){
        $(".nav_title .businessUrl").addClass("active").siblings().removeClass('active');
        $(window).scrollTop(businessHeight);
    });
    $(".caseUrl").click(function(){
        $(".nav_title .caseUrl").addClass("active").siblings().removeClass('active');
        $(window).scrollTop(caseHeight);
    });
    $(".customerUrl").click(function(){
        $(".nav_title .customerUrl").addClass("active").siblings().removeClass('active');
        $(window).scrollTop(customerHeight);
    });
    $(".aboutUrl").click(function(){
        $(".nav_title .aboutUrl").addClass("active").siblings().removeClass('active');
        $(window).scrollTop(aboutHeight);
    });
    $(window).scroll(function () {
        var st = $(this).scrollTop();
        if(st>aboutHeight - 10){
            $(".nav_title .aboutUrl").addClass("active").siblings().removeClass('active');
        }else if(st>customerHeight - 10){
            $(".nav_title .customerUrl").addClass("active").siblings().removeClass('active');
        }else if(st>caseHeight - 10){
            $(".nav_title .caseUrl").addClass("active").siblings().removeClass('active');
        }else if(st>businessHeight - 10){
            $(".nav_title .businessUrl").addClass("active").siblings().removeClass('active');
        }else{
            $(".nav_title .homeUrl").addClass("active").siblings().removeClass('active');
        }
    });
}
